<?php
/**
 * Created by PhpStorm.
 * User: trisatria
 * Date: 1/6/14
 * Time: 3:32 PM
 */

namespace Admin\Model;
class AdminCommend{

    public $id;
    public $user_id;
    public $topic_id;
    public $content;
    public $create_date;

    protected $inputFilter;

    public function exchangeArray($data)
    {
        $this->id     = (isset($data['id'])) ? $data['id'] : null;
        $this->user_id = (isset($data['user_id'])) ? $data['user_id'] : null;
        $this->topic_id  = (isset($data['topic_id'])) ? $data['topic_id'] : null;

        $this->content     = (isset($data['content'])) ? $data['content'] : null;
        $this->create_date = (isset($data['create_date'])) ? $data['create_date'] : null;
    }


    //form use
    public function getInputFilter()
    {
        if (!$this->inputFilter) {
            $inputFilter = new InputFilter();
            $factory     = new InputFactory();

            $inputFilter->add($factory->createInput(array(
                'name'     => 'id',
                'required' => false,
            )));

            $inputFilter->add($factory->createInput(array(
                'name'     => 'topic_id',
                'required' => false,
            )));

            $inputFilter->add($factory->createInput(array(
                'name'     => 'content',
                'required' => false,
            )));

            $inputFilter->add($factory->createInput(array(
                'name'     => 'create_date',
                'required' => false,
            )));
            $inputFilter->add($factory->createInput(array(
                'name'     => 'price',
                'required' => false,

            )));
            $this->inputFilter = $inputFilter;
        }

        return $this->inputFilter;
    }

}
